package com.y.mytest.lang;

import org.apache.commons.lang3.time.DateUtils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @ClassName: mytests
 * @author: 叶子豪
 * @create: 2021-04-09 17:16
 */
public class mytests {
      int i=0;
      
    public static void main(String[] args) throws ParseException {
        //System.out.println(new mytests().getLastDayOfMonth("2021-10-14 14:22:00"));
        new mytests().test(" ");
        /*ThreadManager.getThreadPollProxy().execute(() -> {
            System.out.println("doing you want do!");
            System.out.println("doing you want do!");
        });*/
    }

    public void test(String s) {
        i=0;
    }

    public static String getLastDayOfMonth(String str) throws ParseException {
        Date date = DateUtils.parseDate(str,"yyyy-MM-dd");
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        //获取某月最大天数
        //int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
        int lastDay = cal.getActualMinimum(Calendar.DAY_OF_MONTH);
        //设置日历中月份的最大天数
        cal.set(Calendar.DAY_OF_MONTH, lastDay);
        //格式化日期
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return sdf.format(cal.getTime());
    }

}
